from django.urls import path, re_path
from rest_framework.routers import DefaultRouter
from app_student import views

router = DefaultRouter()  # 有根路由
# router.register(r'teacher', views.TeacherViewSet)
# router.register(r'teacher2', views.TeacherGenericViewSet)
# router.register(r'teacher3', views.TeacherModelViewSet)
router.register(r'teacher', views.TeacherModelViewSet)
router.register(r'student', views.StudentModelViewSet)
urlpatterns = [
    path('user/<int:pk>/', views.TeacherAPIView.as_view()),  # get -> get
    path('user/', views.TeacherListCreateAPIView.as_view()),  # get -> get

    # path('teacher/<int:pk>/', views.TeacherViewSet.as_view({'get': 'retrieve', 'put': 'update', 'delete': 'destroy'})),
    # path('teacher/', views.TeacherViewSet.as_view({'get': 'list', 'post': 'create'})),
    #
    # path('teacher/unactive/', views.TeacherViewSet.as_view({'get': 'unactive'})),
    # path('teacher/<int:pk>/unactive/', views.TeacherViewSet.as_view({'put': 'setunact'})),
]
urlpatterns += router.urls
